home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-30 | 4.9 KB | 169 lines | [TEXT/KAHL] |
- ----------------------------------------------------------------------------
- H o t K e y s 1 . 0
-
- By Robert S. Mah
- rmah@panix.com
-
- ©1993 One Step Beyond
- ----------------------------------------------------------------------------
-
-
- ------------
- Introduction
- ------------
-
- I was writing an extension, and I needed hot key support. No problem, I
- thought, it's been done dozens of times, there must be a library out there
- somewhere on the net.
-
- sumex, umich, wuarchive, ics.uci, snippets, macdev... Nada. Zilch.
-
- Oh well, I thought, I guess I'll have to write my own. Hmm, why not make it
- available to the rest of the world? That way, as more folks use it, I can
- be sure that the bugs are out and get rich and famous too! OK, nix the last
- part.
-
- So here it is. Version 1.0, shiny and new. Ready and rearin' to go!
-
- If you use this HotKeys, please, please, let me know via e-mail. One quick
- message and you'll be kept up to date on the latest versions and bug fixes.
-
-
- ------------
- This Package
- ------------
-
- Since you're a programmer, no installation instructions are given.
-
- The package consists of:
- HotKeys.c // implementation file
- HotKeys.h // interface file
- HotKeys.rsrc // required resources
- HotKeys.π // example project file
- Test.c // example test file
- HotKeys.π.rsrc // resources for example project file
- HotKeys.doc // this file
-
-
- -------------
- Using HotKeys
- -------------
-
- The Functions:
-
- short IsHotKey( const HotKey*, const long msg, const short mods );
-
- Returns 1 if the event message and modifier flags match the given
- hot key. This should be called when a keyDown event has been
- pulled from the event queue.
-
-
- void SetHotKey( HotKey*, const long msg, const short mods );
-
- Sets the given hot key to match the event message and mods passed
- in the other two params.
-
- void ClearHotKey( HotKey* );
-
- Unsets the specified to nothing. Note that this function does NOT
- clear out the fields in the structure, it only sets the onOff flag
- to false.
-
- void SetHotKeyDlog( HotKey* );
-
- Provides a simple user interface so the user can set the hot key.
- Note that this provides no protection against single character hot
- keys. That is application dependent.
-
- OSErr DrawHotKey( const HotKey*, const Rect* );
-
- Call this to draw the graphical representation of the given hot
- key. Much of the code in HotKeys.c is devoted to implementing
- this function.
-
- The Resources:
-
- DLOG/DITL (id = 1024)
-
- The dialog template used by SetHotKeyDlog().
-
- SICN (id = 1024)
-
- This contains the pictures for the modifier keys and a few non-
- printable characters (e.g. delete, fwd delete).
-
- STR# (id = 1024
-
- This contains strings that stand in for non-printable characters
- (e.g. "return", "esc" and "F1").
-
- If you change the id's of these resources, be sure to change the
- globals, gHotKeySICNRsrcID, gHotKeyDLOGRsrcID, and gHotKeyStrsRsrcID
- to match the new resource IDs.
-
- Customization:
-
- At present, the only real simple level of customization is by modifying
- the static data tables named sicnKeys and strKeys. These contain the
- virtual keycodes that are used to determine which small icon or stand-in
- string to draw in place of that keycode.
-
- By changing these tables, and updating the SICN and STR# resources, you
- can change how keycodes are drawn.
-
-
- ---------------
- Version History
- ---------------
-
- Version: 1.0
- Date: 29 Nov 1993
- Notes: Finished first version.
-
-
- ----------------------------------
- Problems, Suggestions & The Future
- ----------------------------------
-
- If you have any problems or suggestions, please let me know. Again, don't
- forget to e-mail me if you use HotKeys so that I can send bug fixes and
- new versions out to you.
-
- "But it's so full featured," you say, "what could possibly be needed?"
-
- Well, I may add support for either (or both) an event filter that processes
- hot keys, so that you can easily add hot keys to your extension. And two,
- a way to use these neat-o, configurable, hot keys in your app's menus.
-
- Anyone have any other ideas?
-
- I can be reached at: Robert S. Mah
- One Step Beyond
-
- Telephone: 212-947-6507
- Fax: 212-563-7192
-
- Internet: rmah@panix.com
- CIS: 72511,421
- AppleLink: rmah
- AOL: rmah
-
-
- -----------
- Legal Stuff
- -----------
-
- This software is protected under U.S. and international copyright laws.
-
- Software may be included in any non-commercial software package free of
- charge as long as proper copyright notification is given.
-
- Proper copyright notification is defined as something similar to "Hot key
- support ©1993 One Step Beyond" in both documentation and any "about box".
-
- Software may be copied and distributed either in its entirety (as defined
- in "The Package" above) or as part of another software package.
-
- For other forms of distribution, contact the author.
-
-